<?php

namespace App\Http\Controllers\Site;
use App\B2BProject\Site\HelperControllerBuildTrait;
use Illuminate\Http\Request;
use App\Http\Requests;
use App\Http\Controllers\Controller;

class AuthController extends Controller
{
    use HelperControllerBuildTrait;
    public function getLogin()
    {
        return view('host/login');
    }

    public function postLogin(Requests\Login\MemberLoginRequest $request)
    {
        $login = $request->only(['user', 'password']);

        if (\Auth::attempt($login)) {
            // TODO 具体登陆成功的反馈逻辑
            return redirect()->route('account.member.home');
        }

        // TODO 具体登陆失败的反馈逻辑
        return 'error';
    }

    public function getLogout()
    {
         \Auth::logout();

        return redirect('/');
    }
}
